package com.zhongyu.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhongyu.pojo.LinkUser;
import com.zhongyu.pojo.Log;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.List;

public interface LogMapper extends BaseMapper<Log> {
    @Select("INSERT INTO  smbms_log (content,yuanyin,TYPE,user_id,createtime) VALUES (#{content},#{yuanyin},#{type},#{userId},#{shijian})")
   void zeng(@Param("content") String content,@Param("yuanyin") String yuanyin, @Param("type") Integer type, @Param("userId")Integer userId, @Param("shijian") LocalDateTime shijian);
    @Select("INSERT INTO  smbms_log (content,yuanyin,TYPE,user_id,createtime) VALUES (#{content},#{yuanyin},#{type},#{userId},#{shijian})")
    void insertCai(@Param("content") String content,@Param("yuanyin") String yuanyin, @Param("type") Integer type, @Param("userId")Integer userId, @Param("shijian") LocalDateTime shijian);
    @Select("SELECT t1.*,t2.username FROM smbms_log t1 JOIN smbms_user t2 ON t1.user_id=t2.id ${ew.customSqlSegment}")
    @ResultMap("logRm")
    List<Log> findAll(Page page, @Param("ew") Wrapper wrapper);
}
